/**
 * Created by yuxang on 2015/8/25.
 * 实现页面跳转时，新页面增加遮罩
 * 防止页面未完全加载时出现布局混乱
 */

(function () {
    var showMaskDiv = function () {
        /*遮罩层*/
        var maskbar = "<div "
            + "class=\"mask\""
            + "style=\"width: 100%; height: 100%; background-color: rgba(255,255,255,0.92); z-index: 99; position: fixed; top: 0; left: 0; right: 0; overflow: hidden; color: red; text-align: center;\">"
            + "<img style='margin-top: 50%;' src=\"images/loading.gif\" alt=\"加载中...\"/>";
            + "加载中。。。";
            + "</div>";
        $("body").append(maskbar);
    };
    window.onload = showMaskDiv;
    setTimeout(function() {
        $('.mask').animate({left: '-100%'}, 600);
    }, 2000);
})();